import * as React from "react";
import {render} from "react-dom";
import Frame from "./components/frame";

let Library = {
    id: 'library',
    title: '媒体库',
    multiple: false,
    content: 'upload',
    menu: 'default',
    router: 'browse',
    toolbar: 'select',
    searchable: true,
    filterable: false,
    sortable: true,
    autoSelect: true,
    describe: false,
    contentUserSetting: true,
    syncSelection: true,
};

let GalleryEdit = Object.assign({}, Library, {
    id:               'gallery-edit',
    title:            '编辑相册',
    multiple:         false,
    searchable:       false,
    sortable:         true,
    date:             false,
    display:          false,
    content:          'browse',
    toolbar:          'gallery-edit',
    describe:         true,
    displaySettings:  true,
    dragInfo:         true,
    idealColumnWidth: 170,
    editing:          false,
    priority:         60,
    syncSelection:    false
});

let GalleryAdd = Object.assign({}, Library, {
    id:            'gallery-library',
    title:         '添加图片到相册',
    multiple:      'add',
    filterable:    'uploaded',
    menu:          'gallery',
    toolbar:       'gallery-add',
    priority:      100,
    syncSelection: false
});

let states = [
    Object.assign({}, Library, {
        id: 'insert',
        title: '插入多媒体',
        toolbar:    'main-insert',
        filterable: 'all',
        multiple: 'reset',
        editable: true,
        allowLocalEdits: true,
        displaySettings: true,
        displayUserSettings: true,
    }),
    Object.assign({}, Library, {
        id:         'gallery',
        title:      '创建相册',
        priority:   40,
        toolbar:    'main-gallery',
        filterable: 'uploaded',
        multiple:   'add',
        editable:   false,
    }),
    Object.assign({}, GalleryEdit, {
        menu: 'gallery'
    }),
    GalleryAdd,
];

render(<Frame states={states}/>, document.getElementById('main'));

